package it.eng.area118.mdocommon.ebus;

import it.eng.area118.mdocommon.Callback;
import it.eng.area118.mdocommon.android.log.BasicLogger;

/**
 * 
 * @author Luigi
 *
 */
public abstract class MessageTextHandler implements Callback<String> {

	public abstract void onMessage(String msg);

	@Override
	public final void onSuccess(String result) {
		if (result != null) {
			BasicLogger.writeLog("MessageReceived", "Message: " + result);
			onMessage(result);
		}
	}

	@Override
	public final void onCancelled() {
		BasicLogger.writeLog("MessageCallback", "Message not received!");

	}

	@Override
	public final void onFailure(Throwable e) {
		BasicLogger.writeLog("MessageCallback", "Message not received!", e);

	}
}
